package com.lagou.utils;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DateUtils {

    public static  String getYear(Date date){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("YYYY");
        String format = simpleDateFormat.format(date);
        System.out.println("转换后的值："+format);
        return format;
    }
    public static  String getMonth(Date date){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("M");
        String format = simpleDateFormat.format(date);
        System.out.println("转换后的值："+format);
        return format;
    }

}
